# -*- conding:UTF-8 -*-

'''
@ Project: one-group
@ File: send_code.py
@ Author: 孙博
@ Date：2022/6/8 18:51

'''

# 容联云通信
from ronglian_sms_sdk import SmsSDK
from common.celery_tasks.celery import app
import json


@app.task
def sms_code(mobile, code, expiry=5):
    sdk = SmsSDK(
        accId="8a216da8804ba8a5018064a0d4520669",
        accToken="b1b59ee7bbdd4f37b240c67dc77a0540",
        appId="8a216da8804ba8a5018064a0d5470670"
    )

    tid = "1"
    mobile = '%s' % mobile
    datas = ('%s' % code, "%s" % expiry)

    res = sdk.sendMessage(tid, mobile, datas)
    print("发送短信的响应", res)
    return res
